﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ESHOP.DAO;
using ESHOP.UTIL;
using ESHOP.Domain;
using E_Shop.Common;
namespace E_Shop
{
    public partial class Companydefault : System.Web.UI.Page
    {
        private readonly HopthuDAO _Email = new HopthuDAO();
        private readonly SellLeadDao _sellLead = new SellLeadDao();
        private readonly BuyLeadDAO _buylead = new BuyLeadDAO();
        private readonly SanPhamDAO _sanphamdao = new SanPhamDAO();
        private readonly GioHangDAO _giohangDao = new GioHangDAO();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session[Constants.SESSION_LOGIN] == null)
            {
                Response.Redirect(WebUrl.LOGIN);
            }
            else
            {
                var account = (ACOUNT)Session[Constants.SESSION_LOGIN];
                var mails = _Email.GetListbyCompaniesReceiver_new(account.MACT);                
                var sellLeads = _sellLead.GetAllSellByCompanyId(account.MACT);
                var buyleads = _buylead.GetBuyCompany(account.MACT);
                var tramalls= _giohangDao.GetListBuyCompanyId(account.MACT);
                lbinbox.Text = mails.Count.ToString();
                lbPosttradelead.Text = buyleads.Count().ToString();
                lbselltrade.Text = sellLeads.Count().ToString();
                trademall.Text = tramalls.Count().ToString();
                var sanphams=_sanphamdao.GetListByCompanyID(account.MACT);
                lbtProduct.Text=sanphams.Count().ToString();
               
            }
           
        }
    }
}